import MathUtil from '@/MathUtil';
import MovementCommon from 'code/Core/Common/MovementCommon';
import AbilityBase from 'code/Scripts/Abilities/base/AbilityBase';
/**
 * 强盗 - 投掷武器
 **/
export default class MSK_ToastWeapon extends AbilityBase {
    static instance: MSK_ToastWeapon;
    constructor(id: string = 'Mqd0') {
        super(id);
        MSK_ToastWeapon.instance = this;
        this.init();
        se.onUnitSpellEffect(this.onSpellEffect.bind(this), this.id);
    }
    init() {}
    cast<T extends Object = any>(tarX: number, tarY: number, source: unit, target: unit, data?: T): void {
        let angle = MathUtil.angleBetweenCoords(GetUnitX(source), GetUnitY(source), tarX, tarY);
        MovementCommon.LineMissile({
            missile: 'abilities\\weapons\\WyvernSpear\\WyvernSpearMissile.mdl',
            caster: source,
            speed: 400,
            distance: 700,
            angle,
            radius: 75,
            onHit: this.onMissileHit.bind(this),
        });
    }
    onMissileHit(p: LineMissileConfig, hit: unit) {
        StunSystemIntance.stun(hit, 2, p.caster, '眩晕');
        DamageSystemInstance.applyPhysicalDamage(hit, p.caster, 1200, this.id);
    }
    onMissileFinish(p: LineMissileConfig) {}
    onSpellEffect() {
        this.cast(GetSpellTargetX(), GetSpellTargetY(), GetTriggerUnit(), GetSpellTargetUnit());
    }
}
